/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __STRING_STRING_IMPL__
#define __STRING_STRING_IMPL__

#include "../tools/head.h"

namespace xos_box
{
    // 
    // buf interface
    // 
    class string_impl : public xos_stl::mem_item< xos::release_impl< string_impl >, thread_lock >,
        public xos_box::i_string
    {
    public:
        typedef xos::release_impl< string_impl > T;

    public:
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //

        static int get_xos_item_data( ITEM_DATA *& item_ptr );

    public:
        string_impl();
        ~string_impl();

    public:
        const char * get( char * lpszStr, size_t tSize ) const;
        i_string * get( i_string * pString );

        size_t length() const;

        i_string * set( const char * lpszStr, size_t tLen );
        i_string * set( const char * lpszStr );
        i_string * set( const i_string * pString );

        i_string * append( const i_string * pString, const char seperator );
        i_string * append( const char * lpszStr, size_t tLen, const char seperator );
        i_string * append( const char * lpszStr, const char seperator );

        i_string * append( const i_string * pString );
        i_string * append( const char * lpszStr );

        i_string * url_append( const i_string * pString );
        i_string * url_append( const char * lpszStr, size_t tLen );
        i_string * url_append( const char * lpszStr );

    public:
        std::string m_str;

    protected:
        int init_data();

    public:
        int init();
        int term();

    public:
    };
}

#endif // __STRING_STRING_IMPL__
